﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminSite.Master"
    Inherits="System.Web.Mvc.ViewPage<IEnumerable<Admin>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#startTime").attr("readonly", "true").datepicker({ dateFormat: 'yy-mm-dd',
                dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
            });

            $("#endTime").attr("readonly", "true").datepicker({ dateFormat: 'yy-mm-dd',
                dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
            });
        });
    </script>
    <div id="content">
        <div id="div_search">
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tr>
                    <td id="left_search">
                    </td>
                    <td id="bg_search">
                        <p>
                            <span id="sitemap">当前位置：</span>
                        </p>
                        <%using (Html.BeginForm("Search", "Member"))
                          {%>
                        <p>
                            用户名：<%=Html.TextBox("memberName", null, new { style = "margin-right:20px" })%>起始时间：<%=Html.TextBox("startTime", null, new { style = "margin-right:20px" })%>截止时间：<%=Html.TextBox("endTime",null, new { style = "margin-right:20px" })%><input
                                type="submit" value="查询" />
                        </p>
                        <%} %>
                    </td>
                    <td id="right_search">
                    </td>
                </tr>
            </table>
        </div>
        <div id="div_list">
            <%if (Model.Count() == 0)
              {
                  Html.RenderPartial("partialNoneDate");
              }
              else
              {%>
            <% var grid = new WebGrid(source: Model, defaultSort: "CreateTime", rowsPerPage: 10, canSort: false, ajaxUpdateContainerId: "divGrid"); %>
            <div id="divGrid">
                <%=grid.GetHtml(tableStyle: "grid", headerStyle: "header",rowStyle:"row", alternatingRowStyle: "alt", footerStyle:"footer",
                    mode:WebGridPagerModes.All, firstText:"首页", previousText:"上一页", nextText:"下一页", lastText:"尾页",
                    columns: grid.Columns(
                                          grid.Column("用户名", format: (item) => Html.ActionLink((string)item.Name, "Details", new { id = item.AdminID, pageId = Request.QueryString["page"] })),
                        grid.Column("CreateTime", "创建时间", style: "datecolumn"),
                        grid.Column("LastEditTime", "最后修改时间",style: "datecolumn"),
                        grid.Column(format: (item) => Html.ActionLink("编辑", "Edit", new { id = item.AdminID, pageId = Request.QueryString["page"] }), style: "buttoncolumn"),
                        grid.Column(format: (item) => Html.ActionLink("删除", "Delete", new { id = item.AdminID }, new { onclick = "return confirm('确定删除该用户？');" }), style: "buttoncolumn")
                    ))
                %>
            </div>
            <%} %>
        </div>
        <div id="div_button">
            <p>
                <%: Html.ActionLink("创建新用户", "Create", new { pageId = Request.QueryString["page"]})%>
            </p>
        </div>
    </div>
</asp:Content>
